<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js是基于对象的语言</title>
</head>
<body>
    <script>
        //内置对象
        let now = new Date();
        console.log(now);

        //自定义对象
        let User = function(id,username){
            this.id = id;
            this.username = username;
            //return this;

            //定义函数
            this.study=function(){
                alert("热爱学习!");
            }
        }

        let user = new User(1,"admin");
        user.id = 100;
        console.log(user.id+":"+user.username);
    
        user.study();

    </script>
</body>
</html>